// 导入fs模块
const fs = require('fs')

// 封装一个函数
function readFiles(path) {
    return new Promise((resolve, reject) => {
        fs.readFile(path, (err, data) => {
            if (err) reject(err)
            resolve(data)
        })
    })
}

// 调用
readFiles('./案例-文件读取/files/first.txt').then(value1 => {
    readFiles('./案例-文件读取/files/second.txt').then(value2 => {
        readFiles('./案例-文件读取/files/third.txt').then(value3 => {
            let value=[value1,value2,value3]
            console.log(value.toString())
        }, reason => {
            console.log(reason)
        })
    }, reason => {
        console.log(reason)
    })
}, reason => {
    console.log(reason)
})